package cn.cdeden.knowledge.service.impl;

import cn.cdeden.common.core.utils.MapstructUtils;
import cn.cdeden.knowledge.domain.vo.FilesVersionsVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.cdeden.knowledge.domain.FilesVersions;
import cn.cdeden.knowledge.mapper.FilesVersionsMapper;
import cn.cdeden.knowledge.service.FilesVersionsService;
@Service
public class FilesVersionsServiceImpl extends ServiceImpl<FilesVersionsMapper, FilesVersions> implements FilesVersionsService{

    @Override
    public List<FilesVersionsVo> getVersionsList(String storageType, String storageId, String sourceFile) {
        QueryWrapper<FilesVersions> wrapper = new QueryWrapper<>();
        wrapper.eq("storage_type",storageType )
            .eq("storage_id",storageId)
            .eq("source_file",sourceFile)
            .orderByDesc("id");
        ;
        return MapstructUtils.convert(this.list(wrapper), FilesVersionsVo.class) ;
//        return ConvertUtil.convertList(this.list(wrapper), FilesVersionsVo.class) ;
    }
}
